package WaiBao;

import java.util.Arrays;

public class SuZiRou {
    public static void main(String[] args) {
        String[] name = {"王一博(班长)", "李可(副班长)", "小李(学习委员)", "张家旺(体育委员)", "陈龙", "曾志伟", "古天乐", "张家辉", "王星", "王欣", "王菲", "配置类",
                "刨冰雨", "李勋", "张天坛", "戴荃", "洪金宝", "赵本山", "小沈阳", "凌更新", "林更新", "周冬雨", "黄渤", "王博", "王宝强", "刘强东", "宿华", "张一鸣",
                "肖战", "苏紫柔(学生)"};//考生本人:苏紫柔(学生)
        int[] age = {21, 18, 19, 20, 19, 21, 18, 21, 18, 20, 18, 18, 18, 20, 20, 19, 18, 18, 18, 18, 19, 19, 20, 20, 20, 18, 20, 21, 20, 20};//考生年龄：20

        double[] zhushou1 = {74, 72, 85, 80, 80, 69, 78, 80, 81, 70, 91, 77, 85, 79, 65, 68, 69, 99, 96, 88, 92, 91, 95, 85, 75, 74, 74, 84, 91, 95};
        double[] zhushou2 = {75, 75, 89, 76, 78, 61, 85, 99, 95, 80, 90, 67, 66, 75, 65, 65, 86, 79, 66, 78, 82, 71, 85, 85, 75, 84, 74, 65, 90, 96};
        double[] zhushou3 = {78, 80, 81, 75, 79, 99, 68, 89, 80, 60, 93, 87, 85, 65, 65, 68, 89, 69, 96, 93, 92, 81, 95, 85, 76, 84, 73, 81, 84, 94};


        double penpen1;//代表每个学生的总分
        double penpen2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            penpen1 = zhushou1[i] +zhushou2[i] +zhushou3[i];
//            penpen2 = (penpen1 * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + penpen1);
//            System.out.println(name[i] + "的平均分为:" +penpen2);
//        }


        double chaunshu1 = 0, chaunshu2 = 0;
        double[] arr = new double[30];
        for (int i = 0; i < 30; i++) {
            chaunshu1 = zhushou1[i] + zhushou2[i] + zhushou3[i];
            chaunshu2  = (chaunshu1 * 1.0) / 3;
            arr[i] = chaunshu2 ;
        }

        for (int i = 0; i < arr.length - 1; i++) {
            for (int j = 0; j < arr.length - i - 1; j++) {
                if (arr[j] < arr[j + 1]) {
                    double tep = arr[j];
                    arr[j] = arr[j + 1];
                    arr[j + 1] = tep;
                }
            }
        }
        System.out.println("前十名同学的成绩为:");
        for (int i = 0; i < 10; i++) {
            System.out.println(arr[i]);
        }


//
//        double ye1 = 0, ye2 = 0, ye3 = 0;//计算每门课的平均分
//        double qu1 = 0, qu2 = 0,qu3 = 0;//计算每门课标准差
        double zh1 = 0, zh2 = 0,zh3 = 0;//计算每门课中位数
//        double sum2 = 0;
//        for (int i = 0; i < zhushou1.length; i++) {
//            sum2+=zhushou1[i];
//        }
//        ye1 = (sum2*1.0)/30;
//        System.out.println("农业设施及环境调控的班级平均分为:"+ye1);
//        double Sum = 0;
//        for (int i = 0; i < zhushou2.length; i++) {
//            Sum+=zhushou2[i];
//        }
//        ye2 = (Sum*1.0)/30;
//        System.out.println("农业设施设计与建造的班级平均分为:"+ye2);
//        double sum = 0;
//        for (int i = 0; i <zhushou3.length; i++) {
//            sum+=zhushou3[i];
//        }
//        ye3 = (sum*1.0)/30;
//        System.out.println("园艺植物设施栽培学的班级平均分为:"+ye3);
//
//
//
//        double c1 = 0,c2 = 0,c3 = 0;
//        for (int i = 0; i < zhushou1.length; i++) {
//            c1+= (zhushou1[i] - ye1)*(zhushou1[i] - ye1);
//        }
//        qu1 = Math.sqrt(c1*1.0/30);
//        System.out.println("农业设施及环境调控的班级标准差为:"+qu1);
//
//        for (int i = 0; i < zhushou2.length; i++) {
//            c2+= (zhushou2[i] -ye2)*(zhushou2[i] - ye2);
//        }
//        qu2 = Math.sqrt(c2*1.0/30);
//        System.out.println("农业设施设计与建造的班级标准差为:"+qu2);
//
//        for (int i = 0; i < zhushou3.length; i++) {
//            c3+= (zhushou3[i] - ye3)*(zhushou3[i] - ye3);
//        }
//        qu3 = Math.sqrt(c3*1.0/30);
//        System.out.println("园艺植物设施栽培学的班级标准差为:"+qu3);
//////
        Arrays.sort(zhushou1);
        Arrays.sort(zhushou2);
        Arrays.sort(zhushou3);
        zh1 =( zhushou1[15]+zhushou1[14])*1.0/2;
        zh2 =( zhushou2[15]+zhushou2[14])*1.0/2;
        zh3 =( zhushou3[15]+zhushou3[14])*1.0/2;
        System.out.println("农业设施及环境调控的中位数为:"+zh1);
        System.out.println("业设施设计与建造的中位数为:"+zh2);
        System.out.println("园艺植物设施栽培学的中位数为:"+zh3);
////


    }
}
